﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace SUMO.MediaBrowser.Controls.Adorners.Frames {
    public partial class CropFrame : Grid, IAdornerFrame {
        private double _zoom = 1.0;
        private double _width = 0;
        private double _height = 0;


        public CropFrame() {
            InitializeComponent();
        }

        public void Attached() {
        }

        public void Detached() {
        }

        public new void SizeChanged(double newWidth, double newHeight) {
            _width = newWidth;
            _height = newHeight;
            UpdateText();
        }

        private void UpdateText()
        {
            string size = String.Format("{0} x {1}", (int)Math.Round(_width / _zoom), (int)Math.Round(_height / _zoom));
            textSize1.Text = size;
            textSize2.Text = size;
        }

        public void SetZoom(double newZoomLevel)
        {
            _zoom = newZoomLevel;
            UpdateText();
        }
    }
}
